package com.wframe.project.jnd.services;

import com.frame.database.JdataBean;
import com.frame.database.PageResult;
import com.wframe.project.jnd.vo.Coupon;

import java.util.List;
import java.util.Set;

public interface CouponService {

    public PageResult queryCoupon(String userid, Integer state, int ordinal, int size, int pageno);

    public List<JdataBean> countCoupon(String userid);

    public String getUsableCount(String userid, int source);

    public PageResult getUsableCoupon(JdataBean parms, int size, int pno);

    public PageResult queryCanCoupon(String userid, Double ordermoney, int ordinal, int size, int pageno);

    public PageResult queryDisCoupon(String userid, Double ordermoney, int ordinal, int size, int pageno);

    public void addCoupon(String userid, String code) throws Exception;

    public JdataBean getCoupon(String id) throws Exception;

    public void tagCouponUsed(String id) throws Exception;

    /**
     * 查询可用的优惠券列表
     *
     * @param userId
     * @param orderMoney
     */
    List findCanCouponList(String userId, Double orderMoney, int ordinal);

    /**
     * 优惠券是否可用
     *
     * @param couponid
     * @param userid
     * @param paymoney
     * @return
     */
    boolean isUsable(String couponid, String userid, int ordinal, double paymoney);

    boolean isExist(String userid, double payMoney, int ordinal);

    /**
     * 用户优惠券列表信息
     *
     * @param userId
     * @param platform
     * @return
     */
    List<Coupon> findReceivedCoupons(String userId, int platform);

    /**
     * 可领取的优惠券
     *
     * @param userId
     * @param platform
     * @return
     */
    List<Coupon> findAvailableCoupons(String userId, int platform);

    /**
     * 商品所有的优惠券
     *
     * @param userid
     * @param productid
     * @param platform
     * @return
     */
    List<Coupon> findAll(String userid, String productid, int platform);

    /**
     * 用户领取优惠券
     */
    void receiveCoupon(JdataBean coupon, String userId, int sourceType);

    /**
     * 根据id查询优惠券信息
     *
     * @param userId
     * @param couponId
     * @param platform
     * @return
     */
    JdataBean findOne(String userId, Integer couponId, int platform);

    List<Coupon> findOrderCoupons(Set<String> ids, String userid, int platform);
}